/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.project.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Malek
 */
@Entity
@Table(name = "PRIX", catalog = "", schema = "ONECOMMERCE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Prix.findAll", query = "SELECT p FROM Prix p"),
    @NamedQuery(name = "Prix.findByIdprix", query = "SELECT p FROM Prix p WHERE p.idprix = :idprix"),
    @NamedQuery(name = "Prix.findBySomme", query = "SELECT p FROM Prix p WHERE p.somme = :somme"),
    @NamedQuery(name = "Prix.findByDateprix", query = "SELECT p FROM Prix p WHERE p.dateprix = :dateprix")})
public class Prix implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "IDPRIX", nullable = false, precision = 22, scale = 0)
    private BigDecimal idprix;
    @Basic(optional = false)
    @NotNull
    @Column(name = "SOMME", nullable = false, precision = 8, scale = 2)
    private BigDecimal somme;
    @Basic(optional = false)
    @NotNull
    @Column(name = "DATEPRIX", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date dateprix;
    @JoinColumn(name = "IDITEM", referencedColumnName = "IDITEM", nullable = false)
    @ManyToOne(optional = false)
    private Item iditem;

    public Prix() {
    }

    public Prix(BigDecimal idprix) {
        this.idprix = idprix;
    }

    public Prix(BigDecimal idprix, BigDecimal somme, Date dateprix) {
        this.idprix = idprix;
        this.somme = somme;
        this.dateprix = dateprix;
    }

    public BigDecimal getIdprix() {
        return idprix;
    }

    public void setIdprix(BigDecimal idprix) {
        this.idprix = idprix;
    }

    public BigDecimal getSomme() {
        return somme;
    }

    public void setSomme(BigDecimal somme) {
        this.somme = somme;
    }

    public Date getDateprix() {
        return dateprix;
    }

    public void setDateprix(Date dateprix) {
        this.dateprix = dateprix;
    }

    public Item getIditem() {
        return iditem;
    }

    public void setIditem(Item iditem) {
        this.iditem = iditem;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idprix != null ? idprix.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Prix)) {
            return false;
        }
        Prix other = (Prix) object;
        if ((this.idprix == null && other.idprix != null) || (this.idprix != null && !this.idprix.equals(other.idprix))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.project.entities.Prix[ idprix=" + idprix + " ]";
    }
    
}
